#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2e5 + 10;
int n, m;
int a[N], b[N];
void solve(){
cin >> n >> m;
if(m >= n){
cout << m - m % n / 2 << "\n";
return ;
}
cout << n + m << "\n";
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t = 1;
cin >> t;
while(t--){
solve();
}
return 0;
}
137C - History | 1443C - The Delivery Dilemma |
6C - Alice Bob and Chocolate | 1077C - Good Array |
285B - Find Marble | 6A - Triangle |
1729A - Two Elevators | 1729B - Decode String |
1729C - Jumping on Tiles | 1729E - Guess the Cycle Size |
553B - Kyoya and Permutation | 1729D - Friends and the Restaurant |
1606C - Banknotes | 580C - Kefa and Park |
342A - Xenia and Divisors | 1033A - King Escape |
39D - Cubical Planet | 1453A - Cancel the Trains |
645A - Amity Assessment | 1144A - Diverse Strings |
1553B - Reverse String | 1073A - Diverse Substring |
630N - Forecast | 312B - Archer |
34D - Road Map | 630I - Parking Lot |
160B - Unlucky Ticket | 371B - Fox Dividing Cheese |
584B - Kolya and Tanya | 137B - Permutation |